//
//  ChatContact.swift
//  app_rn_frontend
//
//  Created by wanghui on 2018/5/23.
//  Copyright © 2018年 Facebook. All rights reserved.
//

import UIKit

@objc class ChatContact:NSObject {
  
  var userId:Int
  @objc var displayName:String
  var avatar:String?
  var tag:String?
  var indexPath:IndexPath?
  
  init(userId:Int,displayName:String,avatar:String? = nil) {
    self.userId = userId
    self.displayName = displayName
    self.avatar = avatar
  }
  
  init(userId:Int,displayName:String,avatar:String? = nil,tag:String) {
    self.userId = userId
    self.displayName = displayName
    self.avatar = avatar
    self.tag = tag
  }
  
    override var hash: Int {
    return userId.hashValue
  }
  
  static func == (lhs: ChatContact, rhs: ChatContact) -> Bool {
    return lhs.userId == rhs.userId
  }
  
  override func isEqual(_ object: Any?) -> Bool {
    guard let other = object as? ChatContact else {
      return false
    }
    return self.userId == other.userId
  }
  
}
